var TcFollowDoctorlookTableList = {// 医生回访表格初始化
    id: "tcFollowDoctorlookTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

function _cellStyles(value, row, index) {
    if (row.revisitStatus == 2) {
        return {
            css: {"background-color": "#fff1d5", "overflow": "hidden", "white-space": "nowrap", "text-overflow": "ellipsis"}
        }
    } else {
        return {css: {"overflow": "hidden", "white-space": "nowrap", "text-overflow": "ellipsis"}}
    }
}

TcFollowDoctorlookTableList.initColumn = function () {//初始化表格的列
    var columns = [
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: 'customerId', field: 'customerId', visible: false, align: 'center', valign: 'middle'},
        {title: '诊所', field: 'arrivalStore', align: 'center', valign: 'middle', sortable: true,width:50,
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {title: '回访人员', field: 'revisit', align: 'center', valign: 'middle', sortable: true,width:100,
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {title: '跟踪状态', field: 'followStatus', align: 'center', valign: 'middle', sortable: true,width:100,
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {title: '消费状态', field: 'consumptionStatus', align: 'center', valign: 'middle', sortable: true,width:100,
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {title: '回访内容', field: 'remarks', align: 'center', valign: 'middle', sortable: true,width:110,
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {title: '回访结果', field: 'revisitContent', align: 'center', valign: 'middle', sortable: true,width:110,
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {
            title: '回访状态', field: 'revisitStatus', align: 'center', valign: 'middle', sortable: true, width: 100,
            formatter: function (value, row, index) {
                if (value == 1) {
                    return "<span>" + "待计划" + "</span>"
                } else if (value == 2) {
                    return "<span>" + "回访完成" + "</span>"
                } else if (value == 3) {
                    return "<span>" + "回访未完成" + "</span>"
                } else if (value == 4) {
                    return "<span>" + "回访取消" + "</span>"
                }
            },
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },

        {title: '计划回访时间', field: 'revisitTime', align: 'center', valign: 'middle', sortable: true,width:100,
            formatter: function (value, row, index) {
                return value.substring(0, 11);
            },
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {
            title: '创建时间', field: 'createTime', align: 'center', valign: 'middle', sortable: true, width: 100,
            formatter: function (value, row, index) {
                return value.substring(0, 11);
            },
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        },
        {
            title: '完成时间', field: 'updateTime', align: 'center', valign: 'middle', sortable: true, width: 100,
            formatter: function (value, row, index) {
                return value.substring(0, 11);
            },
            cellStyle: function (value, row, index) {
                return _cellStyles(value, row, index);
            }
        }
    ];
    return columns;
};

TcFollowDoctorlookTableList.check = function () {// 检查是否选中
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录！");
        return false;
    } else {
        TcFollowDoctorlookTableList.seItem = selected[0];
        return true;
    }
};

TcFollowDoctorlookTableList.search = function () {
    TcFollowDoctorlookTableList.table.refresh();
};

$(function () {

});